package ar.uade.edu.fain.ad.server.dao.entity;

import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

@Entity
@Table(name = "MESA")
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
@DiscriminatorColumn(name = "tipo", discriminatorType = DiscriminatorType.STRING)
@NamedQueries({
	@NamedQuery(name = "mesa.porEstado", query = 
			"	SELECT m FROM MesaEntity m " +
			"	WHERE UPPER(m.estado) = UPPER(:estado) " +
			"		AND m.sector.salon.id = :salonId")
})
public abstract class MesaEntity {

	@Id
	@GeneratedValue
	private Long id;

	@Column
	private String estado;

	@ManyToOne
	@JoinColumn(name = "idSector")
	private SectorEntity sector;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getEstado() {
		return estado;
	}

	public void setEstado(String estado) {
		this.estado = estado;
	}

	public SectorEntity getSector() {
		return sector;
	}

	public void setSector(SectorEntity sector) {
		this.sector = sector;
	}

}
